/*
 * Brush.java	1.0  01/02/2006
 * Brush.java	2.0  10/02/2008
 *
 * This class is the parent class for all the brushes
 * Author:    Isabelle Bichindaritz
 *
 */

import java.awt.*;
import java.nio.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;


public class Brush {

//----------------------------------------------------
// Set the color to paint with the color at source,
// which is the coordinate at the original window to sample 
// the color from
//----------------------------------------------------
public void setColor (Point source, GLAutoDrawable drawable)
{
	byte[] color = new byte[4];
	byte[] colorTemp;
        final GL gl = drawable.getGL();
        final GLU glu = new GLU();
	colorTemp = Painter.getOriginalPixel (source);
	for (int i = 0; i < 3; i++) {
		color[i] =(byte)( ((int)colorTemp[i] + Painter.color) % 256);
	}
	color[3] =  (byte) (255 * Painter.alpha /100.0);
	gl.glColor4ubv( ByteBuffer.wrap(color));
}

} //  end Brush 
